package cn.school.controller.acsys;

import cn.school.acsys.entity.AcsFlowResp;
import cn.school.acsys.service.AccessControlSysService;
import cn.school.acsys.vo.AcsFlowQueryVo;
import cn.school.common.api.CommonPage;
import cn.school.common.api.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @className: AccessCrSysController
 * @author: Alex
 * @date: 2023/3/20
 **/
@RestController
@RequestMapping("/monitor/acsflow")
@Api(tags = "acs flow => 门禁流水")
public class AccessCrSysController {
	
	@Autowired
	private AccessControlSysService accessControlSysService;
	
	@ApiOperation("getAcsFlowList => 分页查询门禁流水")
	@PostMapping("/getAcsFlowList")
	public CommonResult<CommonPage<AcsFlowResp>> getAcsFlowPageList(@RequestBody(required = false) AcsFlowQueryVo vo){
		CommonPage<AcsFlowResp> pageList = accessControlSysService.getAcsFlowList(vo);
		return CommonResult.success(pageList);
	}
	
	@ApiOperation("getAccNumsForAccName => 通过人名查找出账号信息")
	@GetMapping("/getAccNumsForAccName")
	public CommonResult<List<Map<String, String>>> getAccNumsForAccName(@RequestParam(value = "accName") String accName) {
		List<Map<String, String>> result = accessControlSysService.getAccNumsForAccName(accName);
		return CommonResult.success(result);
	}
	
}
